//package com.yike.order.mq;
//
//import com.alibaba.fastjson.JSONObject;
//import com.yike.order.entity.Order;
//import com.yike.order.mapper.OrderMapper;
//import com.yike.order.param.WxQueryRequestParam;
//import com.yike.order.service.WxPayService;
//import com.yike.user.api.service.MerchantFeignService;
//import com.yike.user.api.vo.MerchantFeignVo;
//import lombok.extern.java.Log;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.Map;
//
//@Log
//@Component
//@RocketMQMessageListener(topic = "order-commission-topic", consumerGroup = "order-commission-group")
//public class OrderCommissionListener implements RocketMQListener<Long> {
//
//    @Autowired
//    private OrderMapper orderMapper;
//    @Resource
//    private MerchantFeignService merchantFeignService;
//
//    @Override
//    public void onMessage(Long orderId) {
//        log.info("order-commission-topic 接收到消息：" + orderId);
//        // 获取订单信息
//        Order order = orderMapper.selectById(orderId);
//        if (order != null && order.getStatus() == 1) {
//            log.info("订单：" + order.getOrderNo() + " 准备分润");
//            // 首先处理平台分润，获取商家分润比例
//            MerchantFeignVo merchantFeignVo = merchantFeignService.getMerchantByShopId(order.getShopId());
//            if (merchantFeignVo != null && merchantFeignVo.getCommissionRate() != null) {
//                log.info("订单：" + order.getOrderNo() + " 开始分润");
//
//            } else {
//                log.info("商家分润比例为空，无法处理平台分润：" + order.getOrderNo());
//            }
//        }
//
//    }
//
//}
